<div class="content_ads">
    <?php
        echo $this->element('top_content_ads');
    ?>
</div>
<?php
    //print_r($statistics);
    foreach($statistics as $statistic){
        //echo $statistic['Statistic']['count'];
    }
?>
<script type="text/javascript">
    google.load("visualization", "1", {packages:["corechart"]});
    google.setOnLoadCallback(drawChart);
    function drawChart() {
      var data = google.visualization.arrayToDataTable([
        ["Day", "visitor"],
       <?php foreach ($statistics as $statistic) { 
        echo '["'.$statistic['Statistic']['date'].'",'; echo $statistic['Statistic']['count'].'],';
        } ?>
      ]);

      var options = {
          title: 'Statistic',
          pointSize : 5,
          series: [{color: 'red', pointSize: 5}, {color: 'red', lineWidth: 5}, {color: 'blue', lineWidth: 5}]
        };
      

      var chart = new google.visualization.LineChart(document.getElementById("chart_div"));
      chart.draw(data, options);
    }    
</script>

<div class="col-sm-12 single-view">
<div>
<div class="list-group product-list">
    <h3 class="list-group-item"><?php echo __('Product detail'); ?></h3>
    <div class="list-group-item product-detail">
	<div class="view-detail">
                <div id="addthis">
                    <!-- AddThis Button BEGIN -->
                    <div class="addthis_toolbox addthis_default_style ">
                        <a class="addthis_button_preferred_1"></a>
                        <a class="addthis_button_preferred_2"></a>
                        <a class="addthis_button_preferred_3"></a>
                        <a class="addthis_button_preferred_4"></a>
                        <a class="addthis_button_compact"></a>
                        <a class="addthis_counter addthis_bubble_style"></a>
                    </div>
                    <script type="text/javascript">var addthis_config = {"data_track_addressbar":true};</script>
                    <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-52ccf4bd65cf2575"></script>
                    <!-- AddThis Button END -->
                </div>
		<div class="image">
			<div class="news-img-wrap">
				<div class="mediaelement">
                                    <?php if(!empty($product["Product"]["picture1"])){
                                        echo '<a class="group1" title="'.$product["Product"]["picture1"].'" href="'.$this->webroot."img/uploads/".$product["Product"]["picture1"].'">';
                                                echo $this->Html->image('uploads/'.$product["Product"]["picture1"], array('width' => '275px','alt'=>$product["Product"]["picture1"],''));
                                                echo '</a>';
                                    }else {
                                        echo '<a class="group1" title="" href="'.($this->webroot."img/uploads/default_big_product.jpg").'">';
                                                echo $this->Html->image('uploads/images_resize/default_product.png', array('width' => '275px','alt'=>$product["Product"]["picture1"],''));
                                                echo '</a>';
                                    } ?>
                                   
					<?php if(!empty($product["Product"]["picture2"])){
                                                echo '<a class="group1" title="'.$product["Product"]["picture2"].'" href="'.($this->webroot."img/uploads/".$product["Product"]["picture2"]).'">';
                                                echo $this->Html->image('uploads/images_resize/'.$product["Product"]["picture2"], array('width' => '60px','alt'=>$product["Product"]["picture2"],''));
                                                echo '</a>';
                                            }
                                        ?>		
					<?php if(!empty($product["Product"]["picture3"])){
                                                echo '<a class="group1" title="'.$product["Product"]["picture3"].'" href="'.($this->webroot."img/uploads/".$product["Product"]["picture3"]).'">';
                                                echo $this->Html->image('uploads/images_resize/'.$product["Product"]["picture3"], array('width' => '60px','alt'=>$product["Product"]["picture3"],''));
                                                echo '</a>';
                                            }
                                        ?>		
					<?php if(!empty($product["Product"]["picture4"])){
                                                echo '<a class="group1" title="'.$product["Product"]["picture4"].'" href="'.($this->webroot."img/uploads/".$product["Product"]["picture4"]).'">';
                                                echo $this->Html->image('uploads/images_resize/'.$product["Product"]["picture4"], array('width' => '60px','alt'=>$product["Product"]["picture4"],''));
                                                echo '</a>';
                                            }
                                        ?>		
				</div>
			</div>
		</div>	
            
		<h3 class="title">
			<?php echo $product['Product']['title']; ?>
		</h3>
                <div class="price">
			<span id="pro-price">$<?php echo h($product['Product']['price']); echo '<i class="'.$product['Product']['status'].'"></i>'?></span>
		</div>
                <div class="dec">
			<?php echo $product['Product']['description'];
                        ?>
		</div>
            </div>
        <div class="clearfix"></div>
        </div>
    </div>
</div>
    
<div class="list-group product-list">
    <h3 class="list-group-item"><?php echo __('Related Comments'); ?></h3>
    <div class="list-group-item">
    <div class="related">
            <?php if (!empty($product['Comment'])): ?>
                
                <?php //echo __('Id'); ?>
                <?php //echo __('Comment'); ?>
                <?php //echo __('Product Id'); ?>
                <?php //echo __('Actions'); ?>
                <?php foreach ($product['Comment'] as $comment): ?>
                    <div class="comment">
                    <?php //echo $comment['id']; ?>
                    <div class="description">
                        <?php echo $comment['comment']; ?>
                    </div>
                    <?php //echo $comment['product_id']; ?>
                        
                    </div>
                <?php endforeach; ?>	
            <?php endif; ?>
        <div>
            <?php echo $this->Form->create('Comment', array('enctype' => 'multipart/form-data')); ?>
                    <fieldset>
                        <?php
                            echo $this->Form->input('Comments',
                                array(
                                    'placeholder' => 'Add comment here',
                                    'class' => 'form-control'
                                )
                            );
                           echo $this->Form->input('Email', array('type'=>'hidden', 'value'=>$product['User']['id']));
                        ?>
                    </fieldset>
            <?php echo $this->Form->end(__('Submit')); ?>
        </div>
</div>
</div>
</div>
    
<div class="list-group product-list">
    <h3 class="list-group-item">Contact Info</h3>
    <div class="list-group-item">
        <div class="related">
                <div class="auth">
                        <?php echo '<span id="auth">'.$product['Product']['name'].'</span>'; ?>
                </div>
                <div class="address">
                        <?php if($product['Location']['name']) {echo '<span id="address">'.$product['Location']['name'].'</span>';} ?>
                </div>
                <div class="phone">
                        <span id="phone"><?php echo $product['Product']['phone']; ?></span>
                </div>
                <div class="mail">
                        <span id="mail"><?php echo $product['Product']['email']; ?></span>
                </div>
             <div class="mail">
                        <span id="mail"><?php echo $product['Product']['address']; ?></span>
                </div>
        </div>
    </div>
</div>
</div>
<div id="chart_div" style="width: 650px; height: 400px; float: left;"></div>